import { axios } from "@/utils/request";
import { baseUrl } from "@/services/baseUrl";

//策划分解-左侧树
export function getTreePlanningDecompose(data = {}) {
  return axios({
    url: baseUrl + "/probusiness/planDecomposeTree/getTree",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//策划分解-左侧树【新增】
export function seveTreePlanningDecompose(data = {}) {
  return axios({
    url: baseUrl + "/probusiness/planDecomposeTree/save",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//策划分解-左侧树【编辑】
export function updateTreePlanningDecompose(data = {}) {
  return axios({
    url: baseUrl + "/probusiness/planDecomposeTree/update",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//策划分解-左侧树【详情】
export function detailTreePlanningDecompose(data = {}) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/planDecomposeTree/getDetailByUuid?varchar=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//策划分解-右侧列表
export function getPagePlanningDecompose(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/planDecomposeFile/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
